home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / OOFILE / Test Lots of Objects / testFood.cpp next >
Encoding:
Text File  |  1995-08-08  |  2.5 KB  |  66 lines  |  [TEXT/MMCC]

  1. ,
  2.                                 Type("Type"),
  3.                                 GrossExportImport("GrossExportImport"),
  4.                                 AnnualTurnover("AnnualTurnover"),
  5.                                 NumEmployees("NumEmployees"),
  6.                                 theBlob("blobbie")
  7.     {};
  8. };
  9.  
  10. CLASS_TABLE(dbCategories)
  11.     dbLong               EntrySeq;
  12.     dbChar                Category;
  13.     dbEntriesRef        Entry;
  14.  
  15.     dbCategories():    dbTable("dbCategories"),
  16.                             EntrySeq("EntrySeq",kIndexed),
  17.                             Category(80,"Category",kIndexCompress)
  18.     {};
  19.  
  20. };
  21.  
  22. int main()
  23. {
  24.         dbConnect_ctree theDB;
  25.         dbCategories     categories;
  26.         dbEntries         entries;
  27.         dbRelation        entryCategories;
  28.  
  29.         entryCategories.lhs(entries.EntrySeq, entries.Categories);
  30.         entryCategories.rhs(categories.EntrySeq, categories.Entry);
  31.  
  32.  
  33. // *** CHANGE THE FOLLOWING #if 0  TO  #if 1
  34. // *** TO TEST EITHER A FOLDER OF FILES, 
  35. // *** OR A SINGLE DATABASE CONTAINER FILE
  36. #if 1
  37.         theDB.useSeparateFiles(); 
  38.         if (dbConnect::fileExists("foodDB:Entries.dat"))
  39.             theDB.openConnection("foodDB");
  40.         else 
  41.             theDB.newConnection("foodDB");
  42.         
  43. #else
  44.         if (dbConnect::fileExists("foodDBcontainer"))
  45.             theDB.openConnection("foodDBcontainer");
  46.         else 
  47.             theDB.newConnection("foodDBcontainer");
  48. #endif    
  49.  
  50.     
  51.         cout << "Generating test data" << endl << endl;
  52.  
  53.         theDB.generateTestData("testgen.in", 150);
  54.         
  55.         entries.selectAll();
  56.         cout << "Num Entries: " << entries.count() << endl << endl;
  57.  
  58.         categories.selectAll();
  59.         cout << "Num categories: " << categories.count() << endl << endl;
  60.  
  61. //   theDB.describe(cout);   // VERY BIG DUMP OF ALL DATA!!!!!
  62.  
  63.     exit(EXIT_SUCCESS);
  64.     return EXIT_SUCCESS;
  65. }
  66.